package com.leoman.service;

import com.leoman.entity.LetterAnnexSample;
import com.leoman.entity.User;
import com.leoman.entity.vo.UserInfoVo;
import com.leoman.exception.*;
import com.leoman.service.common.ICommonService;
import org.springframework.data.domain.Page;
import org.springframework.web.multipart.MultipartRequest;

import java.util.Map;

/**
 * UserService
 * Created by 涂奕恒 on 2016/11/23 0023 下午 3:55.
 */
public interface UserService extends ICommonService<User> {

    // 发送验证码
    String sendCode(String mobile, Integer type) throws ParamErrorException, MobileExistException, MobileNotFindException;

    // 用户注册
    User iRegister(String mobile, String password, String code) throws ParamErrorException, MobileExistException, CodeErrorException;

    // 普通用户登录
    User iUserLogin(String mobile, String password) throws ParamErrorException, MobileNotFindException, PasswordErrorException, UserSealStatusException;


    // 检测验证码是否正确
    Integer checkCode(String mobile, String code, Integer type);

    // 第三方用户登录
    User iLoginPlus(String openId,
                    Integer type,
                    String avatar,
                    String nickName,
                    Integer sex) throws ParamErrorException, ThirdTypeErrorException, UserSealStatusException;

    // 忘记密码
    void iForgetPwd(String mobile,
                    String password,
                    String code) throws ParamErrorException, MobileNotFindException, CodeErrorException, UserSealStatusException;

    // 绑定手机号
    void iBindingMobile(Integer userId,
                        String mobile,
                        String password,
                        String code)
            throws ParamErrorException,
            UserNotFindException,
            MobileExistException,
            CodeErrorException,
            UserSealStatusException;

    // 查询用户详情
    User iFindOneByInfo(Integer userId) throws ParamErrorException, UserNotFindException, UserSealStatusException;


    // 修改用户信息
    void iModifyUserInfo(Integer userId,
                         String nickName,
                         String birthday,
                         Integer sex,
                         Integer regionId) throws ParamErrorException, UserNotFindException, UserSealStatusException;

    // 修改用户密码
    void iModifyUserPassword(Integer userId,
                             String oldPassword,
                             String newPassword)
            throws ParamErrorException,
            OldPasswordErrorException,
            UserNotFindException,
            UserSealStatusException;

    // 修改用户头像
    void iModifyUserAvatar(Integer userId, MultipartRequest multipartRequest)
            throws ParamErrorException,
            UserNotFindException,
            UserSealStatusException;

    // 用户申请提现
    void iApplyMoney(Integer userId, Double money, String account)
            throws ParamErrorException,
            UserNotFindException,
            MoneyShortException,
            ApplyMoneyCountMaxException,
            CreateTimeShortException,
            UserSealStatusException;

    // 用户绑定第三方
    void iBindingInfo(Integer userId, Integer type, String openId)
            throws ParamErrorException,
            UserNotFindException,
            UserSealStatusException,
            ThirdExistException;

    // 用户添加意见反馈
    void iAddFeedBack(Integer userId,
                      String mobile,
                      String content) throws ParamErrorException, UserNotFindException, MobileNotFindException, UserSealStatusException;

    // 查询普通用户列表（分页）
    Page<UserInfoVo> iPageByParams(Integer userId, String nickName, Integer pageNum, Integer pageSize);

    // 给用户留言
    void iAddLeave(Integer userId,
                   Integer sourceId,
                   String content,
                   Integer imgNum/*,
                   MultipartRequest multipartRequest*/) throws ParamErrorException, UserNotFindException, UserSealStatusException;

    // 用户购买列表（分页）
    Page<LetterAnnexSample> iPageLetterAnnexByParams(Integer userId, Integer type, Integer pageNum, Integer pageSize);

    // 点赞or取消赞
    void iPraise(Integer userId,
                 Integer sourceId,
                 Integer sourceType,
                 Integer type)
            throws ParamErrorException,
            UserNotFindException,
            UserSealStatusException,
            PraiseNotFindException,
            PraiseExistException;

    // 收藏or取消收藏
    void iCollect(Integer userId,
                  Integer sourceId,
                  Integer sourceType,
                  Integer type)
            throws ParamErrorException,
            UserNotFindException,
            UserSealStatusException,
            CollectNotFindException,
            CollectExistException;

    // 更新版本号
    void iUpdateVersion(String num, MultipartRequest multipartRequest);

    // 比对版本号
    Map<String, Object> iCheckVersion();

    // 删除我的锦囊
    void deleteInfo(Integer sourceId, Integer sourceType) throws ParamErrorException;

    // 充值
    Integer recordMoney(Integer userId, Double money, Integer platform) throws ParamErrorException;

    // *
    // *
    // *
    // * 上面的是移动端接口
    // *
    // * 我是分割线
    // *
    // * 下面的是后台的方法
    // *
    // *
    // *

    // 查询新增普通用户数
    Integer findCountWithNewUser(Integer index);

    // 查询普通用户列表（分页）
    Page<User> pageByParams(String nickName,
                            Integer type,
                            String startTime,
                            String endTime,
                            Integer pageNum,
                            Integer pageSize);

    // 批量修改普通用户状态
    Integer changeUserStatus(Integer[] UserId, Integer status, String content);
}